package org.hxzon.workeasy.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;
import org.hxzon.project.BaseEntity;

@Entity
//@Indexed
public class EasyTag extends BaseEntity implements Comparable<EasyTag> {

    private static final long serialVersionUID = 5156788179539859892L;

    @Transient
    private List<PostTag> postTags;

    @Transient
    private List<FileTag> fileTags;

    @Column(columnDefinition = DefineVarchar2048)
    @Size(max = DefineSize2048)
    @NotEmpty
//	@Field(name="search")
    private String tagName;

    @Column(columnDefinition = DefineVarchar2048)
    @Size(max = DefineSize2048)
//	@Field(name="search")
    private String remark;// 备注

    public String toString() {
        return "[" + this.tagName + "]" + this.remark;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof EasyTag)) {
            return false;
        }
        EasyTag other = (EasyTag) o;
        return this.getTagName().equals(other.getTagName());
    }

    public int hashCode() {
        return this.getTagName().hashCode();
    }

    public int compareTo(EasyTag o) {
        return this.getTagName().compareTo(o.getTagName());
    }

    public List<PostTag> getPostTags() {
        return postTags;
    }

    public void setPostTags(List<PostTag> postTags) {
        this.postTags = postTags;
    }

    public List<FileTag> getFileTags() {
        return fileTags;
    }

    public void setFileTags(List<FileTag> fileTags) {
        this.fileTags = fileTags;
    }

    public String getTagName() {
        return tagName;
    }

    public void setTagName(String name) {
        this.tagName = name;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
